*** Settings ***
Library    ../Library/Project.py
Library    Screenshot
Library    Selenium2Library
Library    AutoItLibrary
Resource    config.robot
Resource    ../Locator/04_写信页面定位信息.resource
Suite Setup    Run Keywords    打开QQ邮箱并登录    AND    Selenium2Library.Set Screenshot Directory    ${OUTPUT_DIR}
Test Setup    Run Keywords    Click Element    ${左侧菜单_写信}    AND   Select Frame    ${邮箱页面_主窗体_iframe}
Test Teardown    Unselect Frame
Suite Teardown    关闭QQ邮箱


*** Test Cases ***
0301_写信_文本邮件发送成功
    Input Text    ${写信_收件人}    karoszeng@163.com    
    Input Text    ${写信_主题}    给karo的礼物邮件    
    Select Frame    ${写信_正文_iframe}
    Input Text    ${写信_正文_body}    karo的礼物邮件内容    
    Unselect Frame
    Select Frame    ${邮箱页面_主窗体_iframe}  
    Click Element    ${写信_顶部_发送}    
    Wait Until Page Contains Element    ${写信_邮件发送成功}    30
    
0302写信_附件邮件发送成功_input_sendkeys
    ${TestData}    Get Test Data
    Input Text    ${写信_收件人}    karoszeng@163.com    
    Input Text    ${写信_主题}    给karo的礼物邮件    
    Sleep    10    
    Input Text    ${写信_添加附件_input}    ${TestData}\\file\\操作集合.xls
    Select Frame    ${写信_正文_iframe}
    Input Text    ${写信_正文_body}    karo的礼物邮件内容    
    Unselect Frame
    Select Frame    ${邮箱页面_主窗体_iframe}  
    Click Element    ${写信_顶部_发送}
    Wait Until Page Contains Element    ${写信_邮件发送成功}    30
            
0303_写信_附件邮件发送成功_system_dialog
    ${TestData}    Get Test Data
    ${UploadFile}    Set Variable    ${TestData}\\file\\操作集合.xls  
    Log    上传文件路径:${UploadFile}    
    Input Text    ${写信_收件人}    karoszeng@163.com    
    Input Text    ${写信_主题}    给karo的礼物邮件    
    Click Element At Coordinates    ${写信_添加附件}    0    0
    Win Wait    打开    
    Control Click    打开    ${EMPTY}    [CLASS:Edit; INSTANCE:1]
    Sleep    1    
    Copy Path To Edit And Submit    ${UploadFile} 
    Sleep    5    
    Select Frame    ${写信_正文_iframe}
    Input Text    ${写信_正文_body}    karo的礼物邮件内容    
    Unselect Frame
    Select Frame    ${邮箱页面_主窗体_iframe}  
    Click Element    ${写信_顶部_发送}
    Wait Until Page Contains Element    ${写信_邮件发送成功}    30
